<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>${appname}</title>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<script type="text/javascript">
	$(function() {
		$('#inputForm input').tooltip();
		//表单验证
		$('#inputForm').checkForm();
		$('#inputForm').ajaxForm(
				{
					 url : _ctx + "/pet/add_dog.do",
					type : "post",
					dataType : "json",
					beforeSubmit : function() {
						var checkReturn = $('#inputForm')
								.checkForm(null, false);
						if (checkReturn) {
							$("#sbmBtn").attr("disabled", "disabled");
						}
						return checkReturn;
					},
					clearForm : false,
					resetForm : false,
					success : function(resp) {
						if (resp.status == '1') {
							parent.ui.msg(resp.msg, 1);
							ui.go(_ctx + '/pet/dog_list.do');
						} else {
							parent.ui.msg(resp.msg, 0);
							$("#sbmBtn").removeClass("disabled").attr(
									"disabled", null);
						}
					},
					error : function(resp) {
						parent.ui.msg('请求发送失败', 0);
						$("#sbmBtn").removeClass("disabled").attr("disabled",
								null);
					}
				});
	});
</script>
</head>
<body>

	<div class="main-container" id="main-container">
		<div class="main-container-inner">

			<div class="main-content" style="margin-left: 0px;">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li><i class="icon-home home-icon"></i>宠物店</li>
						<li>狗狗</li>
						<li class="active">添加</li>
					</ul>
				</div>
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<div class="widget-box">
								<div class="widget-header widget-header-flat">
									<div class="widget-toolbar no-border">
										<a class="btn btn-primary btn-xs"
											href="${ctx}/pet/dog_list.do"><i class="icon-arrow-left"></i>
											返回&nbsp;&nbsp;</a>
									</div>
								</div>
								<div class="widget-body">
									<div class="widget-main">
										<form class="form-horizontal" role="form" id="inputForm"
											action="${ctx}/pet/add_dog.do" method="post">
											<%-- <input type="hidden" name="name" value="${vo.name}"/> --%>
											<div class="form-group">
												<div class="col-sm-3 control-label no-padding-right"
													for="form-field-1">狗狗名称*</div>
												<div class="col-sm-9" style="padding-top: 7px;">
													<input type="text" class="col-xs-10 col-sm-5" name="name"
														id="name" datatype="require" msg="必选项"
										     				value="${vo.name}" oldValue="${vo.name}" 
									  require="true" datatype="require|ajax" msg="请输入昵称|已经被占用" title="必填项"
													 url="${ctx}/pet/dog_check_name.do" />
													
												</div>
											</div>

											<div class="space-4"></div>
											<div class="form-group">
												<div class="col-sm-3 control-label no-padding-right">性别*</div>
												<div class="col-sm-9">
													<select name="sex" id="sex" datatype="require" msg="必选项"
														class="col-xs-10 col-sm-5">
														<option value="">--请选择--</option>
														<option value="1">男</option>
														<option value="2">女</option>
													</select>
												</div>
											</div>

											<div class="space-4"></div>
											<div class="form-group">
												<div class="col-sm-3 control-label no-padding-right"
													for="form-field-2">年龄</div>
												<div class="col-sm-9">
													<input type="text" class="col-xs-10 col-sm-5" name="age"
														id="age" value="${vo.age}" datatype="integer|range"
														min="1" max="100" msg="只能输入数字|年龄值范围1-100" title="必填项" />
												</div>
											</div>

											<div class="space-4"></div>

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right">毛色</label>
												<div class="col-sm-9">
													<input type="text" class="col-xs-10 col-sm-5" name="color"
														id="color" value="${vo.color}" />
												</div>
											</div>

											<div class="space-4"></div>

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right">生日</label>
												<div class="col-sm-9">
													<input type="text" class=" col-xs-10 col-sm-5"
														name="birthday" id="birthday"
														<fmt:formatDate value="${vo.birthday}" pattern="yyyy-MM-dd" />
														onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowWeek:true})" />
												</div>
											</div>


											<hr>
											<div class="clearfix form-group">
												<div class="col-md-offset-3 col-md-9">
													<button type="submit" class="btn btn-sm btn-info"
														id="sbmBtn">
														<i class="icon-ok bigger-110"></i>提交
													</button>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>